import {
  init,
  classModule,
  propsModule,
  styleModule,
  eventListenersModule,
  h,
} from "snabbdom";

const patch = init([
  // Init patch function with chosen modules
  classModule, // makes it easy to toggle classes
  propsModule, // for setting properties on DOM elements
  styleModule, // handles styling on elements with support for animations
  eventListenersModule, // attaches event listeners
]);

const container = document.getElementById("container");

const vnode = h("div", { class: { text: true } }, [
  "div中的文字",
  h(
    "a",
    {
      props: { href: "http://www.baidu.com", target: "_blank" },
    },
    "百度"
  ),
]);
console.log(vnode);
patch(container, vnode);
